/*
 ============================================================================
 文件名 	: EasyBounceRankView.cpp
 描述		: EasyBounceRankView类的实现.
 ============================================================================
 */

//引用
#include <coemain.h>
#include <viewcli.h>
#include <aknviewappui.h>
#include <aknmessagequerydialog.h>
#include <aknnotewrappers.h>
#include <stringloader.h>
#include <EasyBounce.rsg>

#include "EasyBounceRankView.h"
#include "EasyBounceRankContainer.h"
#include "EasyBounce.hrh"

// ============================ 成员函数 ===============================

// ---------------------------------------------------------
// CFileFavorRankView::ConstructL()
// 两阶段构造函数.
// ---------------------------------------------------------
//
void CEasyBounceRankView::ConstructL()
    {
    BaseConstructL( R_EB_RANKVIEW );
    }

// ---------------------------------------------------------
// CEasyBounceRankView::CEasyBounceRankView()
// C++默认构造函数.
// ---------------------------------------------------------
//
CEasyBounceRankView::CEasyBounceRankView()
	{
	
	}

// ---------------------------------------------------------
// CEasyBounceRankView::~CEasyBounceRankView()
// 析构函数.
// ---------------------------------------------------------
//
CEasyBounceRankView::~CEasyBounceRankView()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }

    delete iContainer;
    }

// ---------------------------------------------------------
// CEasyBounceRankView::Id()
// 返回视图ID
// ---------------------------------------------------------
//
TUid CEasyBounceRankView::Id() const
    {
    return KRankViewId;
    }

// ---------------------------------------------------------
// CEasyBounceRankView::HandleCommandL()
// 处理RankView对应的菜单命令 
// ---------------------------------------------------------
//
void CEasyBounceRankView::HandleCommandL(TInt aCommand)
    {   
    switch ( aCommand )
        {
		case EAknSoftkeyBack:
			AppUi()->ActivateLocalViewL( TUid::Uid( EMainViewId ) );
			break;
        default:
            {
            AppUi()->HandleCommandL( aCommand );
            break;
            }
        }
    }

// ---------------------------------------------------------
// CEasyBounceRankView::HandleClientRectChange()
// ---------------------------------------------------------
//
void CEasyBounceRankView::HandleClientRectChange()
    {
    iContainer->SetRect( ClientRect() );
    }

// ---------------------------------------------------------
// CEasyBounceRankView::DoActivateL(...)
// 此函数在视图被激活时调用
// 视图所包含的container在此创建
// 视图被激活时可以接收消息，通过后两个参数来传递
// 参数aPrevViewId，上一个视图的ID
// 参数aCustomMessageId，消息ID
// 参数aCustomMessage，消息内容
// ---------------------------------------------------------
//
void CEasyBounceRankView::DoActivateL(
   const TVwsViewId& /*aPrevViewId*/, TUid /*aCustomMessageId*/,
   const TDesC8& /*aCustomMessage*/)
    {
    if (!iContainer)
        {
        iContainer = new (ELeave) CEasyBounceRankContainer ( this );
        iContainer->SetMopParent( this );
        iContainer->ConstructL( ClientRect() );
        AppUi()->AddToStackL( *this, iContainer );
        } 
   }

// ---------------------------------------------------------
// CEasyBounceRankView::DoDeactivate()
// 视图被反激活时调用此函数
// 此函数里进行对该视图拥有的container进行销毁
// ---------------------------------------------------------
//
void CEasyBounceRankView::DoDeactivate()
    {
    if ( iContainer )
        {
        AppUi()->RemoveFromViewStack( *this, iContainer );
        }
    delete iContainer;
    iContainer = NULL;
    }

// ---------------------------------------------------------
// CEasyBounceRankView::UpdateCbaL()
// 更新CBA
// ---------------------------------------------------------
//
void CEasyBounceRankView::UpdateCbaL()
	{
    // 当视图拥有多于（含）两个container时需要实现此函数
	}

// 文件结束
